
clear;

Ds=24;
rCvM_b1N33=zeros(Ds,1);
rCvM_b1N40=zeros(Ds,1);
rCvM_b1N50=zeros(Ds,1);
rCvM_b1N66=zeros(Ds,1);
rKS_b1N33=zeros(Ds,1);
rKS_b1N40=zeros(Ds,1);
rKS_b1N50=zeros(Ds,1);
rKS_b1N66=zeros(Ds,1);

rCvM_b2N33=zeros(Ds,1);
rCvM_b2N40=zeros(Ds,1);
rCvM_b2N50=zeros(Ds,1);
rCvM_b2N66=zeros(Ds,1);
rKS_b2N33=zeros(Ds,1);
rKS_b2N40=zeros(Ds,1);
rKS_b2N50=zeros(Ds,1);
rKS_b2N66=zeros(Ds,1);

for ii=1:Ds
    if ii==1; load sim0507b_K5D3n2N33; end
    if ii==2; load sim0507b_K5D3n4N33; end
    if ii==3; load sim0507b_K5D3n8N33; end
    if ii==4; load sim0520_n1200N33_b1D1; end
    if ii==5; load sim0507b_K5D1n2N33; end
    if ii==6; load sim0507b_K5D1n4N33; end
    if ii==7; load sim0507b_K5D1n8N33; end
    if ii==8; load sim0520_n1200N33_b1D2; end
    if ii==9; load sim0520_n200N33_b1D3; end
    if ii==10; load sim0520_n400N33_b1D3; end
    if ii==11; load sim0520_n800N33_b1D3; end
    if ii==12; load sim0520_n1200N33_b1D3; end
    if ii==13; load sim0507b_K5D2n2N33; end
    if ii==14; load sim0507b_K5D2n4N33; end
    if ii==15; load sim0507b_K5D2n8N33; end    
    if ii==16; load sim0520_n1200N33_b1D4; end
    if ii==17; load sim0520_n200N33_b1D5; end
    if ii==18; load sim0520_n400N33_b1D5; end
    if ii==19; load sim0520_n800N33_b1D5; end
    if ii==20; load sim0520_n1200N33_b1D5; end
    if ii==21; load sim0520_n200N33_b1D6; end
    if ii==22; load sim0520_n400N33_b1D6; end
    if ii==23; load sim0520_n800N33_b1D6; end
    if ii==24; load sim0520_n1200N33_b1D6; end
    rCvM_b1N33(ii,1)=mean(Tn_CvM>cv_CvM);
    rKS_b1N33(ii,1)=mean(Tn_KS>cv_KS);
end


for ii=1:Ds
    if ii==1; load sim0507b_K5D3n2N40; end
    if ii==2; load sim0507b_K5D3n4N40; end
    if ii==3; load sim0507b_K5D3n8N40; end
    if ii==4; load sim0520_n1200N40_b1D1; end
    if ii==5; load sim0507b_K5D1n2N40; end
    if ii==6; load sim0507b_K5D1n4N40; end
    if ii==7; load sim0507b_K5D1n8N40; end
    if ii==8; load sim0520_n1200N40_b1D2; end
    if ii==9; load sim0520_n200N40_b1D3; end
    if ii==10; load sim0520_n400N40_b1D3; end
    if ii==11; load sim0520_n800N40_b1D3; end
    if ii==12; load sim0520_n1200N40_b1D3; end
    if ii==13; load sim0507b_K5D2n2N40; end
    if ii==14; load sim0507b_K5D2n4N40; end
    if ii==15; load sim0507b_K5D2n8N40; end    
    if ii==16; load sim0520_n1200N40_b1D4; end
    if ii==17; load sim0520_n200N40_b1D5; end
    if ii==18; load sim0520_n400N40_b1D5; end
    if ii==19; load sim0520_n800N40_b1D5; end
    if ii==20; load sim0520_n1200N40_b1D5; end
    if ii==21; load sim0520_n200N40_b1D6; end
    if ii==22; load sim0520_n400N40_b1D6; end
    if ii==23; load sim0520_n800N40_b1D6; end
    if ii==24; load sim0520_n1200N40_b1D6; end
    rCvM_b1N40(ii,1)=mean(Tn_CvM>cv_CvM);
    rKS_b1N40(ii,1)=mean(Tn_KS>cv_KS);
end

for ii=1:Ds
    if ii==1; load sim0520_n200_b1D1; end
    if ii==2; load sim0520_n400_b1D1; end
    if ii==3; load sim0520_n800_b1D1; end
    if ii==4; load sim0520_n1200_b1D1; end    
    if ii==5; load sim0520_n200_b1D2; end
    if ii==6; load sim0520_n400_b1D2; end
    if ii==7; load sim0520_n800_b1D2; end
    if ii==8; load sim0520_n1200_b1D2; end
    if ii==9; load sim0520_n200_b1D3; end
    if ii==10; load sim0520_n400_b1D3; end
    if ii==11; load sim0520_n800_b1D3; end
    if ii==12; load sim0520_n1200_b1D3; end
    if ii==13; load sim0520_n200_b1D4; end
    if ii==14; load sim0520_n400_b1D4; end
    if ii==15; load sim0520_n800_b1D4; end
    if ii==16; load sim0520_n1200_b1D4; end    
    if ii==17; load sim0520_n200_b1D5; end
    if ii==18; load sim0520_n400_b1D5; end
    if ii==19; load sim0520_n800_b1D5; end
    if ii==20; load sim0520_n1200_b1D5; end
    if ii==21; load sim0520_n200_b1D6; end
    if ii==22; load sim0520_n400_b1D6; end
    if ii==23; load sim0520_n800_b1D6; end
    if ii==24; load sim0520_n1200_b1D6; end    
    rCvM_b1N50(ii,1)=mean(Tn_CvM>cv_CvM);
    rKS_b1N50(ii,1)=mean(Tn_KS>cv_KS);
end

for ii=1:Ds
    if ii==1; load sim0507b_K5D3n2N66; end
    if ii==2; load sim0507b_K5D3n4N66; end
    if ii==3; load sim0507b_K5D3n8N66; end
    if ii==4; load sim0520_n1200N66_b1D1; end
    if ii==5; load sim0507b_K5D1n2N66; end
    if ii==6; load sim0507b_K5D1n4N66; end
    if ii==7; load sim0507b_K5D1n8N66; end
    if ii==8; load sim0520_n1200N66_b1D2; end
    if ii==9; load sim0520_n200N66_b1D3; end
    if ii==10; load sim0520_n400N66_b1D3; end
    if ii==11; load sim0520_n800N66_b1D3; end
    if ii==12; load sim0520_n1200N66_b1D3; end
    if ii==13; load sim0507b_K5D2n2N66; end
    if ii==14; load sim0507b_K5D2n4N66; end
    if ii==15; load sim0507b_K5D2n8N66; end    
    if ii==16; load sim0520_n1200N66_b1D4; end
    if ii==17; load sim0520_n200N66_b1D5; end
    if ii==18; load sim0520_n400N66_b1D5; end
    if ii==19; load sim0520_n800N66_b1D5; end
    if ii==20; load sim0520_n1200N66_b1D5; end
    if ii==21; load sim0520_n200N66_b1D6; end
    if ii==22; load sim0520_n400N66_b1D6; end
    if ii==23; load sim0520_n800N66_b1D6; end
    if ii==24; load sim0520_n1200N66_b1D6; end
    rCvM_b1N66(ii,1)=mean(Tn_CvM>cv_CvM);
    rKS_b1N66(ii,1)=mean(Tn_KS>cv_KS);
end


for ii=1:Ds
    if ii==1; load sim0507_K5D3n2N33; end
    if ii==2; load sim0507_K5D3n4N33; end
    if ii==3; load sim0507_K5D3n8N33; end
    if ii==4; load sim0520_n1200N33_b2D1; end
    if ii==5; load sim0507_K5D1n2N33; end
    if ii==6; load sim0507_K5D1n4N33; end
    if ii==7; load sim0507_K5D1n8N33; end
    if ii==8; load sim0520_n1200N33_b2D2; end
    if ii==9; load sim0520_n200N33_b2D3; end
    if ii==10; load sim0520_n400N33_b2D3; end
    if ii==11; load sim0520_n800N33_b2D3; end
    if ii==12; load sim0520_n1200N33_b2D3; end
    if ii==13; load sim0507_K5D2n2N33; end
    if ii==14; load sim0507_K5D2n4N33; end
    if ii==15; load sim0507_K5D2n8N33; end    
    if ii==16; load sim0520_n1200N33_b2D4; end
    if ii==17; load sim0520_n200N33_b2D5; end
    if ii==18; load sim0520_n400N33_b2D5; end
    if ii==19; load sim0520_n800N33_b2D5; end
    if ii==20; load sim0520_n1200N33_b2D5; end
    if ii==21; load sim0520_n200N33_b2D6; end
    if ii==22; load sim0520_n400N33_b2D6; end
    if ii==23; load sim0520_n800N33_b2D6; end
    if ii==24; load sim0520_n1200N33_b2D6; end
    rCvM_b2N33(ii,1)=mean(Tn_CvM>cv_CvM);
    rKS_b2N33(ii,1)=mean(Tn_KS>cv_KS);
end


for ii=1:Ds
    if ii==1; load sim0507_K5D3n2N40; end
    if ii==2; load sim0507_K5D3n4N40; end
    if ii==3; load sim0507_K5D3n8N40; end
    if ii==4; load sim0520_n1200N40_b2D1; end
    if ii==5; load sim0507_K5D1n2N40; end
    if ii==6; load sim0507_K5D1n4N40; end
    if ii==7; load sim0507_K5D1n8N40; end
    if ii==8; load sim0520_n1200N40_b2D2; end
    if ii==9; load sim0520_n200N40_b2D3; end
    if ii==10; load sim0520_n400N40_b2D3; end
    if ii==11; load sim0520_n800N40_b2D3; end
    if ii==12; load sim0520_n1200N40_b2D3; end
    if ii==13; load sim0507_K5D2n2N40; end
    if ii==14; load sim0507_K5D2n4N40; end
    if ii==15; load sim0507_K5D2n8N40; end    
    if ii==16; load sim0520_n1200N40_b2D4; end
    if ii==17; load sim0520_n200N40_b2D5; end
    if ii==18; load sim0520_n400N40_b2D5; end
    if ii==19; load sim0520_n800N40_b2D5; end
    if ii==20; load sim0520_n1200N40_b2D5; end
    if ii==21; load sim0520_n200N40_b2D6; end
    if ii==22; load sim0520_n400N40_b2D6; end
    if ii==23; load sim0520_n800N40_b2D6; end
    if ii==24; load sim0520_n1200N40_b2D6; end
    rCvM_b2N40(ii,1)=mean(Tn_CvM>cv_CvM);
    rKS_b2N40(ii,1)=mean(Tn_KS>cv_KS);
end

for ii=1:Ds
    if ii==1; load sim0520_n200_b2D1; end
    if ii==2; load sim0520_n400_b2D1; end
    if ii==3; load sim0520_n800_b2D1; end
    if ii==4; load sim0520_n1200_b2D1; end    
    if ii==5; load sim0520_n200_b2D2; end
    if ii==6; load sim0520_n400_b2D2; end
    if ii==7; load sim0520_n800_b2D2; end
    if ii==8; load sim0520_n1200_b2D2; end
    if ii==9; load sim0520_n200_b2D3; end
    if ii==10; load sim0520_n400_b2D3; end
    if ii==11; load sim0520_n800_b2D3; end
    if ii==12; load sim0520_n1200_b2D3; end
    if ii==13; load sim0520_n200_b2D4; end
    if ii==14; load sim0520_n400_b2D4; end
    if ii==15; load sim0520_n800_b2D4; end
    if ii==16; load sim0520_n1200_b2D4; end    
    if ii==17; load sim0520_n200_b2D5; end
    if ii==18; load sim0520_n400_b2D5; end
    if ii==19; load sim0520_n800_b2D5; end
    if ii==20; load sim0520_n1200_b2D5; end
    if ii==21; load sim0520_n200_b2D6; end
    if ii==22; load sim0520_n400_b2D6; end
    if ii==23; load sim0520_n800_b2D6; end
    if ii==24; load sim0520_n1200_b2D6; end
    rCvM_b2N50(ii,1)=mean(Tn_CvM>cv_CvM);
    rKS_b2N50(ii,1)=mean(Tn_KS>cv_KS);
end

for ii=1:Ds
    if ii==1; load sim0507_K5D3n2N66; end
    if ii==2; load sim0507_K5D3n4N66; end
    if ii==3; load sim0507_K5D3n8N66; end
    if ii==4; load sim0520_n1200N66_b2D1; end    
    if ii==5; load sim0507_K5D1n2N66; end
    if ii==6; load sim0507_K5D1n4N66; end
    if ii==7; load sim0507_K5D1n8N66; end
    if ii==8; load sim0520_n1200N66_b2D2;  end
    if ii==9; load sim0520_n200N66_b2D3; end
    if ii==10; load sim0520_n400N66_b2D3; end
    if ii==11; load sim0520_n800N66_b2D3; end
    if ii==12; load sim0520_n1200N66_b2D3; end
    if ii==13; load sim0507_K5D2n2N66; end
    if ii==14; load sim0507_K5D2n4N66; end
    if ii==15; load sim0507_K5D2n8N66; end    
    if ii==16; load sim0520_n1200N66_b2D4; end
    if ii==17; load sim0520_n200N66_b2D5; end
    if ii==18; load sim0520_n400N66_b2D5; end
    if ii==19; load sim0520_n800N66_b2D5; end
    if ii==20; load sim0520_n1200N66_b2D5; end
    if ii==21; load sim0520_n200N66_b2D6; end
    if ii==22; load sim0520_n400N66_b2D6; end
    if ii==23; load sim0520_n800N66_b2D6; end
    if ii==24; load sim0520_n1200N66_b2D6; end
    rCvM_b2N66(ii,1)=mean(Tn_CvM>cv_CvM);
    rKS_b2N66(ii,1)=mean(Tn_KS>cv_KS);
end

Ds=[1;1;1;1;2;2;2;2;3;3;3;3;4;4;4;4;5;5;5;5;6;6;6;6];
Ns=[200;400;800;1200;200;400;800;1200;200;400;800;1200;...
       200;400;800;1200;200;400;800;1200;200;400;800;1200];
rCvM=[Ds,Ns,rCvM_b2N33,rCvM_b2N40,rCvM_b2N50,rCvM_b2N66,...
                          rCvM_b1N33,rCvM_b1N40,rCvM_b1N50,rCvM_b1N66];
rKS=[Ds,Ns,rKS_b2N33,rKS_b2N40,rKS_b2N50,rKS_b2N66];

Labela ={'DGP','n','N=33','N=40','N=50','N=66','N=33','N=40','N=50','N=66'};
mat2lat (rCvM,'TableC1.tex','columnlabels',Labela,'format','%2.3f','size','footnotesize');   


    